www.gusucode.com > VC++ 串口调试精灵源代码-源码程序 > VC++ 串口调试精灵源代码-源码程序/code/串口精灵源代码/SettingDlg.cpp

    //Download by http://www.NewXing.com
// SettingDlg.cpp : implementation file
//

#include "stdafx.h"
#include "CommWizard.h"
#include "SettingDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSettingDlg dialog


CSettingDlg::CSettingDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSettingDlg::IDD, pParent)
{
	nPort = 1;
	strSettings = _T("9600,n,8,1");
	strSendString = _T("");
	nTime = 1000;
	//{{AFX_DATA_INIT(CSettingDlg)
	m_nPort = 1;
	m_strSettings = _T("9600,n,8,1");
	m_strSendString = _T("");
	m_nTime = 1000;
	//}}AFX_DATA_INIT
}


void CSettingDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSettingDlg)
	DDX_Text(pDX, IDC_COM, m_nPort);
	DDX_Text(pDX, IDC_COMSETTING, m_strSettings);
	DDX_Text(pDX, IDC_SENDSTRING, m_strSendString);
	DDX_Text(pDX, IDC_TIME, m_nTime);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSettingDlg, CDialog)
	//{{AFX_MSG_MAP(CSettingDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSettingDlg message handlers

BOOL CSettingDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_nPort = nPort;
	m_nTime = nTime;
	m_strSettings = strSettings;
	m_strSendString = strSendString;
	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSettingDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(TRUE);

	nPort = m_nPort;
	nTime = m_nTime;
	strSettings = m_strSettings;
	strSendString = m_strSendString;

	UpdateData(FALSE);
	CDialog::OnOK();
}